package com.maochd.cloud.excel.utils;

import cn.hutool.core.thread.ExecutorBuilder;
import cn.hutool.core.thread.ThreadFactoryBuilder;
import com.maochd.cloud.excel.constant.ExcelConstant;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;

public class ExcelThreadUtil extends ExcelUtils {

    public static final ThreadFactory THREAD_FACTORY =
            ThreadFactoryBuilder.create().setNamePrefix(ExcelConstant.THREAD_PREFIX).build();

    public static final ExecutorService EXECUTOR = ExecutorBuilder.create().
            setCorePoolSize(64).
            setMaxPoolSize(64).
            setKeepAliveTime(0).
            setThreadFactory(THREAD_FACTORY).
            setHandler(new ThreadPoolExecutor.AbortPolicy()).
            setWorkQueue(new LinkedBlockingQueue<>(648)).
            build();

}
